$(document).ready(function(){
  
}); 
/*
 * 按钮后调用后台的service
*/
button_query_onclick = function () 
{
	efgrid.submitInqu( "ef_grid_r", "ZM","ZMCG1101","query");
}

button_update_onclick = function() {
	var status=$('#inqu_status1-0-fdStatus').val();
	if(status == "已发布" || status =="不通过")
		{
		alert("不可修改已发布或不通过的通知");return;
		}
	
	var ei_info=new EiInfo();
	ei_info.setByNodeObject(document.forms[0]); 
	if(ei_info.getBlock('inqu_status1').getRows(0)[0][2].trim()==""){
		EFAlert("标题不能为空");
		return;
	}
	if(ei_info.getBlock('inqu_status1').getRows(0)[0][3].trim()==""){
		EFAlert("内容不能为空");
		return;
	}
	
	var info = getDetail("ef_region_inqu1","inqu_status1");
	if (null != info) {
		EiCommunicator.send("ZMCG1101", "update", info, ajax_callback);
	}
	window.location.reload(); 
}

button_pass_onclick = function (){
	var grid=isSelected("ef_grid_r");
	if (grid == 0){
		return; 
	}
	efgrid.submitForm( "ef_grid_r", "ZM","ZMCG1101","pass",true);
}
button_nopass_onclick = function (){
	var grid=isSelected("ef_grid_r");
	if (grid == 0){
		return; 
	}
	efgrid.submitForm( "ef_grid_r", "ZM","ZMCG1101","nopass",true);
}

efgrid_onRowClicked = function( grid_id, row_index ){ 
	if(grid_id == "ef_grid_r"){ 

		var grid = efgrid.getGridObject(grid_id); 
		var selectedRow=grid.getRowData(row_index);
		for(var item in selectedRow){
			var colname=item;
			var colvalue=selectedRow[item];
			$('#ef_region_inqu1').find('#inqu_status1-0-'+colname).val(colvalue);
		} 
		
	}
}


var ajax_callback = {
		onSuccess : function(eiInfo) {
			var grid = efgrid.getGridObject("ef_grid_r");
			grid.refresh(eiInfo);
		}, 
		onFail:function(eMsg)
		{
			alert("确认失败，原因："+eMsg);
		}

}	
//efgrid_afterAddNewRow = function(grid_id){
//	var userId=$('#userId').val();
//	var userName=$('#userName').val();
//	var fdTime=$('#fdTime').val();
//	
//	var grid = efgrid.getGridObject(grid_id);
//	var rows = grid.getCheckedRows();
//	if(grid_id=="ef_grid_r")
//	{
//		for(var i = 0 ; i < rows.length;i++){
//			grid.setCellValue(rows[i],2,userName,TYPE_DATA);
//			grid.setCellValue(rows[i],3,userId,TYPE_DATA);
//			grid.setCellValue(rows[i],4,fdTime,TYPE_DATA);
//		}
//	}
//}